Solution 23
There Is a Question in There Somewhere
For the last time, a quick reminder of our original question:
I'm trying to use the user_info_2 structure with the NetAddUser function from VBA. Part of this structure is: PBYTE usri2_logon_hours; points to a 21-byte (168 bits) bit string that specifies . . .
How do I include this in my type declaration? Also, there is a constant in the C header as:
Should I just declare this as a long constant with the value of 1? Thanks in advance!
Let's start with the second question. The usri2_max_storage field of the USER_INFO2 structure is a Long field that holds the maximum amount of storage the user is allowed to use on the system. The documentation suggests that you should set it to the constant value USER_MAXSTORAGE_UNLIMITED to allow the user unlimited access to the disk and defines the constant as shown in the question above.
Clearly 1 doesn't make any senseyou can't give a user access to negative disk space, so it's not surprising that the person who sent in the question was confused.
But common sense suggests that using the value 1 doesn't make much sense either, unless you wish to restrict the user to using a single byte of data on the disk.
The answer lies in an understanding of how data is stored in memory. Let's first look at how a Visual Basic Long variable stores certain numbers.
The largest possible value that a Visual Basic Long variable can hold is 2147483647. You can test this using the following code: